/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package amount;

import score.Score;

/**
 *
 * @author Daniel Gribel
 */
public class LetterAndDigitAmount extends ComposedAmount {
    private int counterLetter;
    private int counterDigit;
    
    public LetterAndDigitAmount(Score score, String name) {
        super(score, name);
        this.counterLetter = 0;
        this.counterDigit = 0;
    }
    
    @Override
    public void checkClauses(char character) {
        if(Character.isLetter(character))
            this.counterLetter++;
        if(Character.isDigit(character))
            this.counterDigit++;
    }
    
    @Override
    public void consolidateScore() {
        if(counterLetter > 0 && counterDigit > 0)
            this.setCounter(1);
        else this.setCounter(0);
    }
    
}
